from django.contrib import admin

from app.admin import SimpleModelAdmin
from .models import *


class GalleryInline(admin.TabularInline):
    model = Gallery
    extra = 0
    fields = ['image_name', 'image']


@admin.register(HomePage)
class HomePageAdmin(SimpleModelAdmin):
    list_display = [
        'pk', 'company_name', 'slogan', 'intro_tab', 'gallery_tab', 'contact_tab', 'title',
        'gallery_desc', 'contact_title', 'copyright', 'is_show'
    ]
    list_filter = ['is_show']
    list_display_links = ['pk', 'company_name']
    search_fields = ['company_name']

    inlines = [GalleryInline]
